package ${cfg.dubboServiceImplPackage};

import ${cfg.dubboServicePackage}.${entity}DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.lang.reflect.InvocationTargetException;
import ${cfg.entityVOPackage}.${entity}VO;
import java.util.Map;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import ${package.Service}.${table.serviceName};
import ${package.Entity}.${entity};

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${entity}DubboServiceImpl implements ${entity}DubboService {

    @Autowired
    @Qualifier(value = "${table.serviceName ?uncap_first}Impl")
    ${table.serviceName} ${table.serviceName ?uncap_first};


    @Override
    public ${entity}VO getById(String id) throws InvocationTargetException, IllegalAccessException {
        ${entity} ${entity ?uncap_first} = ${table.serviceName ?uncap_first}.getById(id);
        ${entity}VO ${entity ?uncap_first}VO = new ${entity}VO();
        BeanUtils.copyProperties(${entity ?uncap_first},${entity ?uncap_first}VO);
        return ${entity ?uncap_first}VO;
    }

    @Override
    public void saveOrUpdate(${entity}VO ${entity ?uncap_first}VO) throws InvocationTargetException, IllegalAccessException {
        ${entity} ${entity ?uncap_first} = new ${entity}();
        BeanUtils.copyProperties(${entity ?uncap_first}VO,${entity ?uncap_first});
        ${table.serviceName ?uncap_first}.saveOrUpdate(${entity ?uncap_first});
    }

    @Override
    public void removeById(String id) {
        ${table.serviceName ?uncap_first}.removeById(id);
    }

    @Override
    public PageInfo<${entity}VO> findPageByVO(${entity}VO ${entity ?uncap_first}VO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
        PageInfo<${entity}VO> pageInfo = ${table.serviceName ?uncap_first}.pageByVo(${entity ?uncap_first}VO,pageNum,pageSize);
        return pageInfo;
    }

    @Override
    public void removeByListVo(List<${entity}VO> ${entity ?uncap_first}VOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        ${table.serviceName ?uncap_first}.removeByListVo(${entity ?uncap_first}VOList);
    }

    @Override
    public List listByVo(${entity}VO ${entity ?uncap_first}VO) {
        return ${table.serviceName ?uncap_first}.listByVo(${entity ?uncap_first}VO);
    }
}
</#if>
